package com.bb.flow.api.entries;

import com.bb.flow.config.enumtype.NodeType;

/**
 * @author bigbeard on 2020-02-19
 * <p>
 * 流程上下文信息
 */
public class FlowContext extends NodeNotifyInfo {

    /**
     * 上下文
     */
    private final Object flowContext;
    /**
     * 父流程信息
     */
    private final NotifyParentFlowInfo parentFlowInfo;

    /**
     * 条件节点的key
     */
    private String conditionKey;


    /**
     * @param flowTemplateName 流程模版名称
     * @param nodeKey          节点名称
     * @param flowContext      上下文
     * @param nodeType         节点类型
     * @param flowInstanceName 流程实例名称
     * @param parentFlowInfo   父流程信息
     */
    public FlowContext(
            String flowTemplateName, String nodeKey
            , Object flowContext, NodeType nodeType
            , String flowInstanceName
            , NotifyParentFlowInfo parentFlowInfo) {

        this.setFlowInstanceName(flowInstanceName);
        this.setFlowTemplateName(flowTemplateName);
        this.setNodeKey(nodeKey);
        this.flowContext = flowContext;
        this.setNodeType(nodeType.toString());
        this.parentFlowInfo = parentFlowInfo;
    }

    public Object getFlowContext() {
        return flowContext;
    }


    public NotifyParentFlowInfo getParentFlowInfo() {
        return parentFlowInfo;
    }

    @Override
    public BaseFlowNotify setFlowInstanceName(String flowInstanceName) {
        return super.setFlowInstanceName(flowInstanceName);
    }

    public String getConditionKey() {
        return conditionKey;
    }

    public void setConditionKey(String conditionKey) {
        this.conditionKey = conditionKey;
    }

}
